<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%-- <%@ page import="java.text.SimpleDateFormat"%>  --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学校信息</title>
<link rel="stylesheet" href="../common/kindeditor-4.1.10/themes/default/default.css" />
<script charset="utf-8" src="../common/kindeditor-4.1.10/kindeditor-min.js"></script>
<script charset="utf-8" src="../common/kindeditor-4.1.10/lang/zh_CN.js"></script>
<%@ include file="../../common/importLib.jsp" %>
<script type="text/javascript">
	/**
	 * 增删改查参数设置
	 */
	tablePageSize=5;
	tableTitle = "学校信息表";
	tableURL = getTimeURL("schoolInfo/schoolInfoList.do");
	toolbarView =0;
	tableColumns = [[{field:'ck',checkbox:true},
						{field:'opt',title:'操作',width:130,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){	
							var queryUrl = 'schoolInfo/queryById.do?schoolId=' + rowData.id;						
							return "<a title='修改' class='xxl_linkbutton' iconCls='icon-edit' href='javascript:datagridUpdate(\"" + queryUrl + "\")'>修改</a>";
						}
					},
	                {field:'id',title:'id',width:0,rowspan:1},		               
	                {field:'logoSm',title:'学校图标',width:70,align:'center',rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.logoSm==""){
								return "";
							}else{
								var url=mrjyFile+"maintain/schoolpic/"+rowData.logoSm+"?"+new Date().getTime();
								return "<img onclick=\"viewPic('"+url+"')\" src='"+url+"' style='width:50px;height:40px;'/>";
							}
						}},
					{field:'schoolIcon',title:'书签图标',width:70,align:'center',rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.schoolIcon==""){
								return "";
							}else{
								var url=mrjyFile+"maintain/schoolpic/"+rowData.schoolIcon+"?"+new Date().getTime();
								return "<img onclick=\"viewPic('"+url+"')\" src='"+url+"' style='width:50px;height:40px;'/>";
							}
						}},
	                {field:'schoolCode',title:'机构域名',width:120,align:'center',rowspan:1},	             
					{field:'schoolName',title:'机构名称',width:120,align:'center',rowspan:1},	
					{field:'schoolNamejc',title:'学校简称',width:120,align:'center',rowspan:1},	
					
					{field:'schoolThemes',title:'网站主题颜色',width:120,align:'center',rowspan:1,
						formatter:function(value,rowData,rowIndex){
						if(rowData.schoolThemes == 1){
							return "蓝色主题";
						}else if(rowData.schoolThemes == 2){
							return "红色主题";
						}else if(rowData.schoolThemes == 3){
							return "黄色主题";
						}else if(rowData.schoolThemes == 4){
							return "绿色主题";
						}
					}},	
					{field:'weixin',title:'微信号',width:100,align:'center',rowspan:1},
					{field:'schoolPhone',title:'机构固定电话',width:100,align:'center',rowspan:1},
					{field:'schoolMobilePhone',title:'机构手机号码',width:100,align:'center',rowspan:1},
					{field:'logoBg',title:'机构大图标',width:100,align:'center',rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.logoBg==""){
								return "";
							}else{
								var url=mrjyFile+"maintain/schoolpic/"+rowData.logoBg+"?"+new Date().getTime();
								return "<img onclick=\"viewPic('"+url+"')\" src='"+url+"' style='width:50px;height:40px;'/>";
							}
						}},
					{field:'qrCode',title:'二维码',width:100,align:'center',rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.qrCode==""){
								return "";
							}else{
								var url=mrjyFile+"maintain/schoolpic/"+rowData.qrCode+"?"+new Date().getTime();
								return "<img onclick=\"viewPic('"+url+"')\" src='"+url+"' style='width:50px;height:40px;'/>";
							}
						}},
					{field:'registerDateStr',title:'注册时间',width:150,align:'center',rowspan:1},	
					{field:'officeAddress',title:'详细地址',width:250,align:'center',rowspan:1},
					{field:'schoolDesc',title:'学校简介',width:500,align:'center',rowspan:1},
					//{field:'ourDevelop',title:'成长历程',width:250,align:'center',rowspan:1},
					{field:'disableFlag',title:'禁用状态',width:80,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.disableFlag == 0){
								return "<font color='green'>起用</font>";
							}else{
								return "<font color='red'>禁用</font>";
							}
						}
					}]];
	
	var addWidth = 900; //添加窗口宽度
	var addHeight = 500; //添加窗口高度
	var addTitle = "添加学校"; //添加标题
	var updateWidth = 900; //修改窗口宽度
	var updateHeight = 500; //修改窗口高度
	var updateTitle = "修改学校"; //修改标题
	var updateDisableFlagUri = "schoolInfo/updateDisableFlag.do"; //禁用、起用记录
	var deleteUri = "schoolInfo/deleteByIds.do"; //删除记录
	
	

	/**
	 * 初始化修改表单
	 */
	
	function initUpdateForm(jsonObject){
		$("#logoSmUpdate").val(jsonObject.logoSm);
		$("#logoBgUpdate").val(jsonObject.logoBg);
		$("#weixinUpdate").val(jsonObject.weixin);
		$("#qrCodeUpdate").val(jsonObject.qrCode);
		$("#schoolIconUpdate").val(jsonObject.schoolIcon);
		$("#smName").attr("src",imgTip_school(jsonObject.logoSm));
		$("#bgName").attr("src",imgTip_school(jsonObject.logoBg));
		$("#qcName").attr("src",imgTip_school(jsonObject.qrCode));
		$("#siName").attr("src",imgTip_school(jsonObject.schoolIcon));
		openPicSmUploadUpdate();openPicBgUploadUpdate();openPicQcUploadUpdate();openPicSiUploadUpdate();
		$("#idUpdate").val(jsonObject.id);
		$("#schoolCodeUpdate").html(jsonObject.schoolCode);
		$("#schoolNameUpdate").html(jsonObject.schoolName);
		$("#schoolPhoneUpdate").val(jsonObject.schoolPhone);
		$("#schoolMobilePhoneUpdate").val(jsonObject.schoolMobilePhone);	
		$("#schoolDescUpdate").val(jsonObject.schoolDesc);
		editorUpdate.html(jsonObject.schoolDesc);		
		//$("#ourDevelopUpdate").val(jsonObject.ourDevelop);
		//editorUpdate2.html(jsonObject.ourDevelop);	
		$("#officeAddressUpdate").val(jsonObject.officeAddress);
		$("#schoolNamejcUpdate").html(jsonObject.schoolNamejc);
		//$("#myDomainUpdate").html(jsonObject.myDomain);
		//$("#buyFlagUpdate").val(jsonObject.buyFlag);
		$("#schoolThemesUpdate").html(jsonObject.schoolThemes);
		updateFormProcess("schoolNameUpdate","机构");
		//$("#city_4Update").citySelect({prov:jsonObject.province, city:jsonObject.city, dist:jsonObject.county}); 
		//KindEditor.html("#schoolDescUpdate", jsonObject.schoolDesc);
		baseFormValidator("schoolNameUpdate","学校名称",4,40); 	
		baseFormValidator("schoolMobilePhoneUpdate","电话",11,11,"mobile");
		baseFormValidator("schoolCodeUpdate","二级域名",1,60,"ascii");
		baseFormValidator("officeAddressUpdate","详细地址",1,200);
		baseFormValidator("schoolNamejcUpdate","学校简称",2,16);
	}
	
	
	/**
	 *打开修改照片上传组件
	 */
	function openPicSmUploadUpdate(){
		uploadOneFile("uploadFileSmUpdate","/mrjy_file/common/util/upload.do","1000KB",100,30,"uploadMessageSmUpdate","backup/maintain/schoolpic/","logoSmUpdate","smName");
	}
	function openPicBgUploadUpdate(){
		uploadOneFile("uploadFileBgUpdate","/mrjy_file/common/util/upload.do","1000KB",100,30,"uploadMessageBgUpdate","backup/maintain/schoolpic/","logoBgUpdate","bgName");
	}	
	function openPicQcUploadUpdate(){
		uploadOneFile("uploadFileQcUpdate","/mrjy_file/common/util/upload.do","1000KB",100,30,"uploadMessageQcUpdate","backup/maintain/schoolpic/","qrCodeUpdate","qcName");
	}
	function openPicSiUploadUpdate(){
		uploadOneFile("uploadFileSiUpdate","/mrjy_file/common/util/upload.do","1000KB",100,30,"uploadMessageSiUpdate","backup/maintain/schoolpic/","schoolIconUpdate","siName");
	}
	function imgTip_school(imgName){
		if(imgName==""){
			return "../common/images/tip.png";
		}else{
			return mrjyFile+"maintain/schoolpic/"+imgName;
		}
	}

	function clearForm(){
		$('#buyFlagSelect').combobox('clear');
		$('#schoolThemesSelect').combobox('clear');
		$('#tempFlagSelect').combobox('clear');
	}
</script>
</head>
<body id="layout" class="easyui-layout">
	
	<div region="center">
	<!-- datagrid信息表 -->
	<table id="datagrid_table"></table>
	</div>
	<!-- 修改记录 -->
	<div id="datagrid_update" style="display: none;">
		<form id="update_form" action="schoolInfo/updateById.do" method="post">
			<input type="hidden" id="idUpdate" name="id"/>
			<input type="hidden" id="logoSmUpdate" name="logoSm" onclick='openPicSmUploadUpdate()'>
			<input type="hidden" id="logoBgUpdate" name="logoBg" onclick='openPicBgUploadUpdate()'>
			<input type="hidden" id="qrCodeUpdate" name="qrCode" onclick='openPicQcUploadUpdate()'>
			<input type="hidden" id="schoolIconUpdate" name="schoolIcon" onclick='openPicSiUploadUpdate()'>
			<table align="center" style="margin: 0 auto" class="xxl_tb_1">
				<tbody>
					<tr>
						<td  class="xxl_td_2">域名：</td>
						<td id="schoolCodeUpdate"></td>
						<td></td>
					</tr>
					
					<tr>
						<td class="xxl_td_2">学校名称：</td>
						<td id="schoolNameUpdate"></td>
						<td></td>
					</tr>
					<tr>
						<td class="xxl_td_2">学校简称：</td>
						<td id="schoolNamejcUpdate"></td>
						<td></td>
					</tr>
					<tr height="40">	
						<td class="xxl_td_1">书签图标：</td>						
						<td>
							<div class="div"><input id='uploadFileSiUpdate' type='file' name='uploadFile'/><span id='uploadMessageSiUpdate'></span></div>
							<img style="height: 80px;width: 80px;" id ="siName" src=""/>
						</td>
						<td><div style="color:red"> *书签图标后缀名为ico，格式16*16px</div></td>	
					</tr>
					<tr height="40">
						<td class="xxl_td_1">上传小logo：</td>						
						<td>
							<div class="div"><input id='uploadFileSmUpdate' type='file' name='uploadFile'/><span id='uploadMessageSmUpdate'></span></div>
							<img style="height: 80px;width: 80px;" id ="smName" src=""/>
						</td>
						<td><div style="color:red"> *小logo后缀名为png，格式高为70px,宽不能超过120px</div></td>	
					</tr>
					<tr height="40">
						<td class="xxl_td_1">上传大logo：</td>						
						<td>
							<div class="div"><input id='uploadFileBgUpdate' type='file' name='uploadFile'/><span id='uploadMessageBgUpdate'></span></div>
							<img style="height: 80px;width: 80px;" id ="bgName" src=""/>
						</td>
						<td><div style="color:red"> *大logo后缀名为png，格式高为70px,宽不能超过300px</div></td>	
					</tr>
					<tr height="40">
						<td class="xxl_td_1">上传二维码：</td>						
						<td>
							<div class="div"><input id='uploadFileQcUpdate' type='file' name='uploadFile'/><span id='uploadMessageQcUpdate'></span></div>
							<img style="height: 80px;width: 80px;" id ="qcName" src=""/>
						</td>
						<td><div style="color:red"> *二维码后缀名为png，格式为100*100px</div></td>
					</tr>
					
					<tr>
						<td class="xxl_td_2">学校微信：</td>
						<td><input type="text" id="weixinUpdate" name="weixin" /></td>
						<td><div id="weixinUpdateTip" style="width:250px"></div></td>
					</tr>	
					<tr>
						<td class="xxl_td_2">固定电话：</td>
						<td><input type="text" id="schoolPhoneUpdate" name="schoolPhone" /></td>
						<td></td>
					</tr>					
					<tr>
						<td class="xxl_td_2">手机号码：</td>
						<td><input type="text" id="schoolMobilePhoneUpdate" name="schoolMobilePhone" maxlength="11"/></td>
						<td><div id="schoolMobilePhoneUpdateTip" style="width:250px"></div></td>
					</tr>
					<tr>
						<td  class="xxl_td_2">详细地址：</td>
						<td ><input type="text" id="officeAddressUpdate" name="officeAddress" style="width: 400px;"/></td>
						<td ><div id="officeAddressUpdateTip" style="width:250px"></div></td>
					</tr>
					<tr>
						<td  class="xxl_td_1">学校简介：</td>
						<td colspan="2">	
							<textarea id="schoolDescUpdate" name="schoolDesc" class="kindeditor2" style="width: 400px;height: 300px"></textarea>
						</td>
					</tr>
					<!--<tr>
						<td  class="xxl_td_1">成长历程：</td>
						<td colspan="2">
							<textarea id="ourDevelopUpdate" name="ourDevelop"  class="kindeditor3" ></textarea>						
						</td>					
					</tr>-->
					<tr>
						<td colspan="3" style="text-align: center">					
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="$('#update_form').submit();">修改</a>		
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_update').window('close');">取消</a>
						</td>
					</tr>
					<tr height="20px;"></tr>
				</tbody>
			</table>
		</form>
	</div>
</body>
</html>